{extend name="public/layout"}

{block name="assign"}
{if isset($info)}
{assign name="page_title" value="编辑配置" /}
{else/}
{assign name="page_title" value="新增配置" /}
{/if}
{/block}

{block name="body"}
<div class="layui-card">
	<div class="layui-card-body">
		<form action="{:url()}" method="post" class="layui-form layui-form-edit" lay-filter="action">
			<input type="hidden" value="{$info.id|default='0'}" name="id"/>
			<input type="hidden" name="http_referer" value="{$Request.server.HTTP_REFERER|default=''}"/>

			<div class="layui-form-item">
				<label for="name" class="layui-form-label">配置标识<i class="required"></i></label>
				<div class="layui-input-block">
					<input type="text" name="name" id="name" class="layui-input" value="{$info.name|default=''}"/>
					<div class="layui-form-mid">用于\think\Config::get调用，只能使用英文且不能重复</div>
				</div>
			</div>

			<div class="layui-form-item">
				<label for="title" class="layui-form-label">配置标题<i class="required"></i></label>
				<div class="layui-input-block">
					<input type="text" name="title" id="title" class="layui-input" value="{$info.title|default=''}"/>
					<div class="layui-form-mid">用于后台显示的配置标题</div>
				</div>
			</div>

			<div class="layui-form-item">
				<label for="type" class="layui-form-label">配置类型<i class="required"></i></label>
				<div class="layui-input-block">
					<select name="type" id="type">
						{volist name="Think.config.web.config_type_list" id="type"}
						{present name="info.type"}
						<option value="{$key}" {$key==$info.type?"selected":""}>{$type}</option>
						{else/}
						<option value="{$key}">{$type}</option>
						{/present}
						{/volist}
					</select>
					<div class=" layui-form-mid">系统会根据不同类型解析配置值</div>
				</div>
			</div>

			<div class="layui-form-item">
				<label for="group" class="layui-form-label">配置分组<i class="required"></i></label>
				<div class="layui-input-block">
					<select name="group" id="group">
						<option value="">不选择分组</option>
						{volist name="Think.config.web.config_group_list" id="group"}
						{present name="info.group"}
						<option value="{$key}" {$key==$info.group?"selected":""}>{$group}</option>
						{else/}
						<option value="{$key}">{$group}</option>
						{/present}
						{/volist}
					</select>
					<div class="layui-form-mid">配置分组 用于批量设置 不分组则不会显示在系统设置中</div>
				</div>
			</div>

			<div class="layui-form-item">
				<label for="value" class="layui-form-label">配置值</label>
				<div class="layui-input-block">
					<textarea name="value" id="value" rows="4" class="layui-textarea">{present name="info"}{$info->getData('value')|default=''}{/present}</textarea>
					<div class="layui-form-mid">配置值</div>
				</div>
			</div>

			<div class="layui-form-item">
				<label for="extra" class="layui-form-label">配置项</label>
				<div class="layui-input-block">
					<textarea name="extra" id="extra" rows="4" class="layui-textarea">{present name="info"}{$info->getData('extra')|default=''}{/present}</textarea>
					<div class="layui-form-mid">如果是枚举型 需要配置该项</div>
				</div>
			</div>

			<div class="layui-form-item">
				<label for="remark" class="layui-form-label">说明</label>
				<div class="layui-input-block">
					<textarea name="remark" id="remark" rows="4" class="layui-textarea" maxlength="255">{$info.remark|default=''}</textarea>
					<div class="layui-form-mid">配置详细说明</div>
				</div>
			</div>

			{neq name="Request.action" value="edit"}
			<div class="layui-form-item">
				<div class="layui-input-block">
					<button type="submit" class="layui-btn layui-btn-danger" data-ajax-post="{target:'.layui-form'}">
						<i class="fa fa-save"></i> 保存
					</button>
					<a href="javascript:history.back();" class="layui-btn layui-btn-primary">取消 </a>
				</div>
			</div>
			{/neq}

		</form>
	</div>
</div>
{/block}

{block name="foot"}
<script type="text/javascript">
</script>
{/block}
